home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_vim.idb / usr / freeware / share / vim / doc / insert.txt.z / insert.txt
Encoding:
Text File  |  1998-10-28  |  31.0 KB  |  751 lines

  1. *insert.txt*    For Vim version 5.0.  Last modification: 1998 Feb 18
  2.  
  3.  
  4.           VIM REFERENCE MANUAL    by Bram Moolenaar
  5.  
  6.  
  7. Inserting and replacing text                *mode-ins-repl*
  8.  
  9. Most of this file is about Insert and Replace mode.  At the end are a few
  10. commands for inserting text in other ways.
  11.  
  12. 1. Special keys                        |ins-special-keys|
  13. 2. Special special keys                    |ins-special-special|
  14. 3. 'textwidth' and 'wrapmargin' options            |ins-textwidth|
  15. 4. 'expandtab', 'smarttab' and 'softtabstop'  options    |ins-expandtab|
  16. 5. Replace mode                        |replace-mode|
  17. 6. Insert mode completion                |ins-completion|
  18. 7. Insert mode commands                    |inserting|
  19. 8. Ex insert commands                    |inserting-ex|
  20. 9. Inserting a file                    |inserting-file|
  21.  
  22. ==============================================================================
  23. 1. Special keys                        *ins-special-keys*
  24.  
  25. In Insert and Replace mode, the following characters have a special meaning;
  26. other characters are inserted directly.  To insert one of these special
  27. characters into the buffer, precede it with CTRL-V.  To insert a <Nul>
  28. character use "CTRL-V CTRL-@" or "CTRL-V 000".  On some systems, you have to
  29. use "CTRL-V 003" to insert a CTRL-C.
  30.  
  31. If you are working in a special language mode when inserting text, see the
  32. 'langmap' option, |'langmap'|, on how to avoid switching this mode on and off
  33. all the time.
  34.  
  35. If you have 'insertmode' set, <Esc> and a few other keys get another meaning.
  36. See |'insertmode'|.
  37.  
  38. char        action    ~
  39. -----------------------------------------------------------------------
  40.                         *i_CTRL-[* *i_<Esc>*
  41. <Esc> or CTRL-[    End insert or Replace mode, go back to Normal mode.  Finish
  42.         abbreviation.
  43.                         *i_CTRL-C*
  44. CTRL-C        Quit insert mode, go back to Normal mode.  Do not check for
  45.         abbreviations.
  46.  
  47.                         *i_CTRL-@*
  48. CTRL-@        Insert previously inserted text and stop insert.  {Vi: only
  49.         when typed as first char, only up to 128 chars}
  50.                         *i_CTRL-A*
  51. CTRL-A        Insert previously inserted text.  {not in Vi}
  52.  
  53.                         *i_CTRL-H* *i_<BS>*
  54. <BS> or CTRL-H    Delete the character before the cursor (see |i_backspacing|
  55.         about joining lines).  See |:fixdel| if your <BS> does not do
  56.         what you want.  {Vi: does not delete autoindents}
  57.                         *i_<Del>*
  58. <Del>        Delete the character under the cursor.  If the cursor is at
  59.         the end of the line, and the 'backspace' option is non-zero,
  60.         delete the <EOL>; the next line is appended after the current
  61.         one.  See |:fixdel| if your <Del> key does not do what you
  62.         want.  {not in Vi}
  63.                         *i_CTRL-W*
  64. CTRL-W        Delete the word before the cursor (see |i_backspacing| about
  65.         joining lines).  See the section "word motions",
  66.         |word-motions|, for the definition of a word.
  67.                         *i_CTRL-U*
  68. CTRL-U        Delete all entered characters in the current line (see
  69.         |i_backspacing| about joining lines).
  70.  
  71.                         *i_CTRL-I* *i_<Tab>*
  72. <Tab> or CTRL-I Insert a tab.  If the 'expandtab' option is on, the
  73.         equivalent number of spaces is inserted (use CTRL-V <Tab> to
  74.         avoid the expansion).  See also the 'smarttab' option and
  75.         |ins-expandtab|.
  76.                         *i_CTRL-J* *i_<NL>*
  77. <NL> or CTRL-J    Begin new line.
  78.                         *i_CTRL-M* *i_<CR>*
  79. <CR> or CTRL-M    Begin new line.
  80.                         *i_CTRL-K*
  81. CTRL-K {char1} {char2}
  82.         Enter digraph (see |digraphs|).  When {char1} is a special
  83.         key, the code for that key is inserted.  Neither char is
  84.         considered for mapping.  {not in Vi}
  85.  
  86. CTRL-N        Find next keyword (see |i_CTRL-N|).  {not in Vi}
  87. CTRL-P        Find previous keyword (see |i_CTRL-P|).  {not in Vi}
  88.  
  89. CTRL-R <0-9a-z"%#:.-=>                *i_CTRL-R* *i_<C-R>*
  90.         Insert the contents of register.  Between typing CTRL-R and
  91.         the second character '"' will be displayed to indicate that
  92.         you are expected to enter the name of a register.
  93.         The text is inserted as if you typed it, but mappings and
  94.         abbreviations are not used.  If you have options like
  95.         'textwidth', 'formatoptions', or 'autoindent' set, this will
  96.         influence what will be inserted.  This is different from what
  97.         happens with the "p" command and pasting with the mouse.
  98.         Special registers:
  99.             '"'    the unnamed register, containing the text of
  100.                 the last delete or yank
  101.             '%'    the current file name
  102.             '#'    the alternate file name
  103.             ':'    the last command line
  104.             '.'    the last inserted text
  105.             '-'    the last small (less than a line) delete
  106.             '='    the expression register: you are prompted to
  107.                 enter an expression (see |expression|)
  108.         See |registers| about registers.  {not in Vi}
  109.  
  110.                         *i_CTRL-T*
  111. CTRL-T        Insert one shiftwidth of indent at the start of the current
  112.         line.  The indent is always rounded to a 'shiftwidth' (this is
  113.         vi compatible).  {Vi: only when in indent}
  114.                         *i_CTRL-D*
  115. CTRL-D        Delete one shiftwidth of indent at the start of the current
  116.         line.  The indent is always rounded to a 'shiftwidth' (this is
  117.         vi compatible).  {Vi: CTRL-D works only when used after
  118.         autoindent}
  119.                         *i_0_CTRL-D*
  120. 0 CTRL-D    Delete all indent in the current line.  {Vi: CTRL-D works
  121.         only when used after autoindent}
  122.                         *i_^_CTRL-D*
  123. ^ CTRL-D    Delete all indent in the current line.  The indent is
  124.         restored in the next line.  This is useful when inserting a
  125.         label.  {Vi: CTRL-D works only when used after autoindent}
  126.  
  127.                         *i_CTRL-V*
  128. CTRL-V        Insert next non-digit literally.  For special keys, the
  129.         terminal code is inserted.  Up to three digits form the
  130.         decimal value of a single byte (see below |i_CTRL-V_digit|.
  131.         The non-digit and the three digits are not considered for
  132.         mapping.  {Vi: no decimal byte entry}
  133.  
  134.                         *i_CTRL-Q*
  135. CTRL-Q        Same as CTRL-V.
  136.  
  137. CTRL-X        Enter CTRL-X mode.  This is a sub-mode where commands can
  138.         be given to complete words or scroll the window. See below,
  139.         |i_CTRL-X|, and in 4.3.6, |ins-completion|. {not in Vi}
  140.  
  141.                         *i_CTRL-E*
  142. CTRL-E        Insert the character which is below the cursor.  {not in Vi}
  143.                         *i_CTRL-Y*
  144. CTRL-Y        Insert the character which is above the cursor.  {not in Vi}
  145.         Note that for CTRL-E and CTRL-Y 'textwidth' is not used, to be
  146.         able to copy characters from a long line.
  147.  
  148.                         *i_CTRL-_*
  149. CTRL-_        Switch between languages, as follows:
  150.         -  When in a rightleft window, revins and nohkmap are toggled,
  151.            since English will likely be inserted in this case.
  152.         -  When in a norightleft window, revins and hkmap are toggled,
  153.            since Hebrew will likely be inserted in this case.
  154.  
  155.         CTRL-_ moves the cursor to the end of the typed text.
  156.  
  157.         Please refer to |rightleft.txt| for more information about
  158.         right-to-left mode.
  159.         {not in Vi}
  160.         Only if compiled with the |+rightleft| feature (which is not
  161.         the default).
  162.  
  163.                         *i_CTRL-]*
  164. CTRL-]        Trigger abbreviation, without inserting a character.  {not in
  165.         Vi}
  166.  
  167.                         *i_<Insert>*
  168. <Insert>    Toggle between insert and replace mode.  {not in Vi}
  169. -----------------------------------------------------------------------
  170.  
  171.                         *i_backspacing*
  172. The effect of the <BS>, CTRL-W, and CTRL-U depend on the 'backspace' option
  173. (unless 'revins' is set):
  174.  
  175. backspace    action
  176.  option
  177.    0       delete stops in column 1 and start position of insert
  178.    1       delete stops at start position of insert
  179.    2       delete always; CTRL-W and CTRL-U stop once at start position of
  180.        insert
  181.  
  182. If the 'backspace' option is non-zero and the cursor is in column 1 when one
  183. of the three keys is used, the current line is joined with the previous
  184. line.  This effectively deletes the <EOL> in front of the cursor.  {Vi: does
  185. not cross lines, does not delete past start position of insert}
  186.  
  187.                         *i_CTRL-V_digit*
  188. With CTRL-V followed by one, two, or three digits, you can enter the decimal
  189. value of any byte, except 10.  Normally CTRL-V is followed by three digits.
  190. The formed byte is inserted as soon as you type the third digit.  If you type
  191. only one or two digits and then a non-digit, the decimal value of those one
  192. or two digits form the byte.  After that the non-digit is dealt with in the
  193. normal way.  If you enter a value of 10, it will end up in the file as a 0.
  194. The 10 is a <NL>, which is used internally to represent the <Nul> character.
  195. When writing the buffer to a file, the <NL> character is translated into
  196. <Nul>.  The <NL> character is written at the end of each line.  Thus if you
  197. want to insert a <NL> character in a file you will have to make a line
  198. break.  The maximum value that can be entered is 255.
  199.  
  200.                         *i_CTRL-X* *insert_expand*
  201. CTRL-X enters a sub-mode where several commands can be used.  Most of these
  202. commands do keyword completion; see |ins-completion|.  These are not available
  203. when Vim was compiled without the |+insert_expand| feature.
  204.  
  205. Two commands can be used to scroll the window up or down, without exiting
  206. insert mode:
  207.  
  208.                         *i_CTRL-X_CTRL-E*
  209. CTRL-X CTRL-E        scroll window one line up.
  210.  
  211.                         *i_CTRL-X_CTRL-Y*
  212. CTRL-X CTRL-Y        scroll window one line down.
  213.  
  214. After CTRL-X is pressed, each CTRL-E (CTRL-Y) scrolls the window up (down) by
  215. one line unless that would cause the cursor to move from its current position
  216. in the file.  As soon as another key is pressed, CTRL-X mode is exited and
  217. that key is interpreted as in Insert mode.
  218.  
  219.  
  220. ==============================================================================
  221. 2. Special special keys                *ins-special-special*
  222.  
  223. The following keys are special.  They stop the current insert, do something,
  224. and then restart insertion.  This means you can do something without getting
  225. out of Insert mode.  This is very handy if you prefer to use the Insert mode
  226. all the time, just like editors that don't have a separate Normal mode.  You
  227. may also want to set the 'backspace' option to 2 and set the 'insertmode'
  228. option.  You can use CTRL-O if you want to map a function key to a command.
  229.  
  230. The changes (inserted or deleted characters) before and after these keys can
  231. be undone separately.  Only the last change can be redone and always behaves
  232. like an "i" command.
  233.  
  234. char        action    ~
  235. -----------------------------------------------------------------------
  236. <Up>        cursor one line up                 *i_<Up>*
  237. <Down>        cursor one line down                 *i_<Down>*
  238. <Left>        cursor one character left             *i_<Left>*
  239. <Right>        cursor one character right             *i_<Right>*
  240. <S-Left>    cursor one word back (like "b" command)         *i_<S-Left>*
  241. <C-Left>    cursor one word back (like "b" command)         *i_<C-Left>*
  242. <S-Right>    cursor one word forward (like "w" command)   *i_<S-Right>*
  243. <C-Right>    cursor one word forward (like "w" command)   *i_<C-Right>*
  244. <Home>        cursor to first char in the line         *i_<Home>*
  245. <End>        cursor to after last char in the line         *i_<End>*
  246. <C-Home>    cursor to first char in the file         *i_<C-Home>*
  247. <C-End>        cursor to after last char in the file         *i_<C-End>*
  248. <LeftMouse>    cursor to position of mouse click         *i_<LeftMouse>*
  249. <S-Up>        move window one page up                 *i_<S-Up>*
  250. <PageUp>    move window one page up                 *i_<PageUp>*
  251. <S-Down>    move window one page down             *i_<S-Down>*
  252. <PageDown>    move window one page down             *i_<PageDown>*
  253. CTRL-O        execute one command, return to Insert mode   *i_CTRL-O*
  254. -----------------------------------------------------------------------
  255.  
  256. Note: If the cursor keys take you out of Insert mode, check the 'noesckeys'
  257. option.
  258.  
  259. The CTRL-O command sometimes has one side effect: If the cursor was beyond the
  260. end of the line, it will be put on the last character in the line.
  261. The shifted cursor keys are not available on all terminals.
  262.  
  263. When the 'whichwrap' option is set appropriately, the <Left> and <Right>
  264. keys on the first/last character in the line make the cursor wrap to the
  265. previous/next line.
  266.  
  267. ==============================================================================
  268. 3. 'textwidth' and 'wrapmargin' options            *ins-textwidth*
  269.  
  270. The 'textwidth' option can be used to automatically break a line before it
  271. gets too long.  Set the 'textwidth' option to the desired maximum line
  272. length.  If you then type more characters (not spaces or tabs), the
  273. last word will be put on a new line (unless it is the only word on the
  274. line).  If you set 'textwidth' to 0, this feature is disabled.
  275.  
  276. The 'wrapmargin' option does almost the same.  The difference is that
  277. 'textwidth' has a fixed width while 'wrapmargin' depends on the width of the
  278. screen.  When using 'wrapmargin' this is equal to using 'textwidth' with a
  279. value equal to (columns - 'wrapmargin'), where columns is the width of the
  280. screen.
  281.  
  282. When 'textwidth' and 'wrapmargin' are both set, 'textwidth' is used.
  283.  
  284. The line is only broken automatically when using insert mode, or when
  285. appending to a line.  When in replace mode and the line length is not
  286. changed, the line will not be broken.
  287.  
  288. Long lines are broken if you enter a non-white character after the margin.
  289. The situations where a line will be broken can be restricted by adding
  290. characters to the 'formatoptions' option:
  291. "l"  Only break a line if it was not longer than 'textwidth' when the insert
  292.      started.
  293. "v"  Only break at a white character that has been entered during the
  294.      current insert command.  This is mostly Vi-compatible.
  295. "lv" Only break if the line was not longer than 'textwidth' when the insert
  296.      started and only at a white character that has been entered during the
  297.      current insert command.  Only differs from "l" when entering non-white
  298.      characters while crossing the 'textwidth' boundary.
  299.  
  300. If you want to format a block of text, you can use the "gq" operator.  Type
  301. "gq" and a movement command to move the cursor to the end of the block.  In
  302. many cases, the command "gq}" will do what you want (format until the end of
  303. paragraph).  Alternatively, you can use "gqap", which will format the whole
  304. paragraph, no matter where the cursor currently is.  Or you can use Visual
  305. mode: hit "v", move to the end of the block, and type "gq".  See also |gq|.
  306.  
  307. ==============================================================================
  308. 4. 'expandtab', 'smarttab' and 'softtabstop' options    *ins-expandtab*
  309.  
  310. If the 'expandtab' option is on, spaces will be used to fill the amount of
  311. whitespace of the tab.  If you want to enter a real <Tab>, type CTRL-V first.
  312. The 'expandtab' option is off by default.  Note that in Replace mode, a single
  313. character is replaced with several spaces.  The result of this is that the
  314. number of characters in the line increases.  Backspacing will delete one
  315. space at a time.  The original character will be put back for only one space
  316. that you backspace over (the last one).  {Vi does not have the 'expandtab'
  317. option}
  318.  
  319.                             *ins-smarttab*
  320. When the 'smarttab' option is on, a <Tab> inserts 'shiftwidth' positions at
  321. the beginning of a line and 'tabstop' positions in other places.  This means
  322. that often spaces instead of a <Tab> character are inserted.  When 'smarttab
  323. is off, a <Tab> always inserts 'tabstop' positions, and 'shiftwidth' is only
  324. used for ">>" and the like.  {not in Vi}
  325.  
  326.                             *ins-softtabstop*
  327. When the 'softtabstop' option is non-zero, a <Tab> inserts 'softtabstop'
  328. positions, and a <BS> used to delete white space, will delete 'softtabstop'
  329. positions.  This feels like 'tabstop' was set to 'softtabstop', but a real
  330. <Tab> character still takes 'tabstop' positions, so your file will still look
  331. correct when used by other applications.
  332.  
  333. If 'softtabstop' is non-zero, a <BS> will try to delete as much white space to
  334. move to the previous 'softtabstop' position, except when the previously
  335. inserted character is a space, then it will only delete the character before
  336. the cursor.  Otherwise you cannot always delete a single character before the
  337. cursor.  You will have to delete 'softtabstop' characters first, and then type
  338. extra spaces to get where you want to be.
  339.  
  340.  
  341. ==============================================================================
  342. 5. Replace mode                    *replace-mode* *mode-replace*
  343.  
  344. In Replace mode, one character in the line is deleted for every character you
  345. type.  If there is no character to delete (at the end of the line), the
  346. typed character is appended (as in Insert mode).  Thus the number of
  347. characters in a line stays the same until you get to the end of the line.
  348. If a <NL> is typed, a line break is inserted and no character is deleted.
  349.  
  350. Be careful with <Tab> characters.  If you type a normal printing character in
  351. its place, the number of characters is still the same, but the number of
  352. columns will become smaller.
  353.  
  354. If you delete characters in Replace mode (with <BS>, CTRL-W, or CTRL-U), what
  355. happens is that you delete the changes.  The characters that were replaced
  356. are restored.  If you had typed past the existing text, the characters you
  357. added are deleted.  This is effectively a character-at-a-time undo.
  358.  
  359. If the 'expandtab' option is on, a <Tab> will replace one character with
  360. several spaces.  The result of this is that the number of characters in the
  361. line increases.  Backspacing will delete one space at a time.  The original
  362. character will be put back for only one space that you backspace over (the
  363. last one).  {Vi does not have the 'expandtab' option}
  364.  
  365. ==============================================================================
  366. 6. Insert mode completion                *ins-completion*
  367.  
  368. In Insert and Replace modes, there are several commands to complete part of a
  369. keyword or line that has been typed.  This is useful if you are using
  370. complicated keywords (e.g., function names with capitals and underscores).
  371.  
  372. These commands are not available when the |+insert_expand| feature was
  373. disabled at compile time.
  374.  
  375. Completion can be done for:
  376.  
  377. 1. Whole lines                        |i_CTRL-X_CTRL-L|
  378. 2. keywords in the current file                |i_CTRL-X_CTRL-N|
  379. 3. keywords in 'dictionary'                |i_CTRL-X_CTRL-K|
  380. 4. keywords in the current and included files        |i_CTRL-X_CTRL-I|
  381. 5. tags                            |i_CTRL-X_CTRL-]|
  382. 6. file names                        |i_CTRL-X_CTRL-F|
  383. 7. definitions or macros                |i_CTRL-X_CTRL-D|
  384. 8. keywords in 'complete'                |i_CTRL-N|
  385.  
  386. All these (except 2) are done in CTRL-X mode.  This is a sub-mode of Insert
  387. and Replace modes.  You enter CTRL-X mode by typing CTRL-X and one of the
  388. CTRL-X commands.  You exit CTRL-X mode by typing a key that is not a valid
  389. CTRL-X mode command.  Valid keys are the CTRL-X command itself, CTRL-N (next),
  390. and CTRL-P (previous).
  391.  
  392. Also see the 'infercase' option if you want to adjust the case of the match.
  393.  
  394. Note: The keys that are valid in CTRL-X mode are not mapped.  This allows for
  395. ":map ^F ^X^F" to work (where ^F is CTRL-F and ^X is CTRL-X).  The key that
  396. ends CTRL-X mode (any key that is not a valid CTRL-X mode command) is mapped.
  397.  
  398. The following mappings are suggested to make typing the completion commands
  399. a bit easier (although they will hide other commands):
  400.     :inoremap ^] ^X^]
  401.     :inoremap ^F ^X^F
  402.     :inoremap ^D ^X^D
  403.     :inoremap ^L ^X^L
  404.  
  405.  
  406. Completing whole lines                    *compl-whole-line*
  407.  
  408.                             *i_CTRL-X_CTRL-L*
  409. CTRL-X CTRL-L        Search backwards for a line that starts with the
  410.             same characters as in the current line before the
  411.             cursor.  Indent is ignored.  The found line is
  412.             inserted in front of the cursor.
  413.     CTRL-L    or
  414.     CTRL-P        Search backwards for next matching line.  This line
  415.             replaces the previous matching line.
  416.  
  417.     CTRL-N        Search forward for next matching line.  This line
  418.             replaces the previous matching line.
  419.  
  420.     CTRL-X CTRL-L    After expanding a line you can additionally get the
  421.             line next to it by typing CTRL-X CTRL-L again, unless
  422.             a double CTRL-X is used.
  423.  
  424. Completing keywords in current file            *compl-current*
  425.  
  426.                             *i_CTRL-X_CTRL-P*
  427.                             *i_CTRL-X_CTRL-N*
  428. CTRL-X CTRL-N        Search forwards for words that start with the keyword
  429.             in front of the cursor.  The found keyword is inserted
  430.             in front of the cursor.
  431.  
  432. CTRL-X CTRL-P        Search backwards for words that start with the keyword
  433.             in front of the cursor.  The found keyword is inserted
  434.             in front of the cursor.
  435.  
  436.     CTRL-N        Search forward for next matching keyword.  This
  437.             keyword replaces the previous matching keyword.
  438.  
  439.     CTRL-P        Search backwards for next matching keyword.  This
  440.             keyword replaces the previous matching keyword.
  441.  
  442.     CTRL-X CTRL-N or
  443.     CTRL-X CTRL-P    Further use of CTRL-X CTRL-N or CTRL-X CTRL-P will
  444.             copy the words following the previous expansion in
  445.             other contexts unless a double CTRL-X is used.
  446.  
  447. If there is a keyword in front of the cursor (a name made out of alphabetic
  448. characters and characters in 'iskeyword'), it is used as the search pattern,
  449. with "\<" prepended (meaning: start of a word).  Otherwise "\<\k\k" is used
  450. as search pattern (start of any keyword of at least two characters).
  451.  
  452. In Replace mode, the number of characters that are replaced depends on the
  453. length of the matched string.  This works like typing the characters of the
  454. matched string in Replace mode.
  455.  
  456. If there is not a valid keyword character before the cursor, any keyword of
  457. at least two characters is matched.
  458.     e.g., to get:
  459.         printf("(%g, %g, %g)", vector[0], vector[1], vector[2]);
  460.     just type:
  461.         printf("(%g, %g, %g)", vector[0], ^P[1], ^P[2]);
  462.  
  463. Multiple repeats of the same completion are skipped; thus a different match
  464. will be inserted at each CTRL-N and CTRL-P (unless there is only one
  465. matching keyword).
  466.  
  467. Single character matches are never included, as they usually just get in
  468. the way of what you were really after.
  469.     e.g., to get:
  470.         printf("name = %s\n", name);
  471.     just type:
  472.         printf("name = %s\n", n^P);
  473.     or even:
  474.         printf("name = %s\n", ^P);
  475. The 'n' in '\n' is skipped.
  476.  
  477. After expanding a word, you can use CTRL-X CTRL-P or CTRL-X CTRL-N to get the
  478. word following the expansion in other contexts.  These sequences search for
  479. the text just expanded and further expand by getting an extra word.  This is
  480. useful if you need to repeat a sequence of complicated words.  Although CTRL-P
  481. and CTRL-N look just for strings of at least two characters, CTRL-X CTRL-P and
  482. CTRL-X CTRL-N can be used to expand words of just one character.
  483.     e.g., to get:
  484.         México
  485.     you can type:
  486.         M^N^P^X^P^X^P
  487. CTRL-N starts the expansion and then CTRL-P takes back the single character
  488. "M", the next two CTRL-X CTRL-P's get the words "é" and ";xico".
  489.  
  490. If the previous expansion was split, because it got longer than 'textwidth',
  491. then just the text in the current line will be used.
  492.  
  493. If the match found is at the end of a line, then the first word in the next
  494. line will be inserted and the message "word from next line" displayed, if
  495. this word is accepted the next CTRL-X CTRL-P or CTRL-X CTRL-N will search
  496. for those lines starting with this word.
  497.  
  498.  
  499. Completing keywords in 'dictionary'            *compl-dictionary*
  500.  
  501.                             *i_CTRL-X_CTRL-K*
  502. CTRL-X CTRL-K        Search the files given with the 'dictionary' option
  503.             for words that start with the keyword in front of the
  504.             cursor.  This is like CTRL-N, but only the dictionary
  505.             files are searched, not the current file.  The found
  506.             keyword is inserted in front of the cursor.  This
  507.             could potentially be pretty slow, since all matches
  508.             are found before the first match is used.  By default,
  509.             the 'dictionary' option is empty.
  510.             For suggestions where to find a list of words, see the
  511.             'dictionary' option.
  512.  
  513.     CTRL-K    or
  514.     CTRL-N        Search forward for next matching keyword.  This
  515.             keyword replaces the previous matching keyword.
  516.  
  517.     CTRL-P        Search backwards for next matching keyword.  This
  518.             keyword replaces the previous matching keyword.
  519.  
  520.  
  521. Completing keywords in the current and included files    *compl-keyword*
  522.  
  523. The 'include' option is used to specify a line that contains an include file
  524. name.  The 'path' option is used to search for include files.
  525.  
  526.                             *i_CTRL-X_CTRL-I*
  527. CTRL-X CTRL-I        Search for the first keyword in the current and
  528.             included files that starts with the same characters
  529.             as those before the cursor.  The matched keyword is
  530.             inserted in front of the cursor.
  531.  
  532.     CTRL-N        Search forwards for next matching keyword.  This
  533.             keyword replaces the previous matching keyword.
  534.             Note: CTRL-I is the same as <Tab>, which is likely to
  535.             be typed after a succesful completion, therefore
  536.             CTRL-I is not used for searching for the next match.
  537.  
  538.     CTRL-P        Search backward for previous matching keyword.  This
  539.             keyword replaces the previous matching keyword.
  540.  
  541.     CTRL-X CTRL-I    Further use of CTRL-X CTRL-I will copy the words
  542.             following the previous expansion in other contexts
  543.             unless a double CTRL-X is used.
  544.  
  545. Completing tags                        *compl-tag*
  546.                             *i_CTRL-X_CTRL-]*
  547. CTRL-X CTRL-]        Search for the first tag that starts with the same
  548.             characters as before the cursor.  The matching tag is
  549.             inserted in front of the cursor.  Alphabetic
  550.             characters and characters in 'iskeyword' are used
  551.             to decide which characters are included in the tag
  552.             name (same as for a keyword).  See also |CTRL-]|.
  553.     CTRL-]    or
  554.     CTRL-N        Search forwards for next matching tag.  This tag
  555.             replaces the previous matching tag.
  556.  
  557.     CTRL-P        Search backward for previous matching tag.  This tag
  558.             replaces the previous matching tag.
  559.  
  560.  
  561. Completing file names                    *compl-filename*
  562.                             *i_CTRL-X_CTRL-F*
  563. CTRL-X CTRL-F        Search for the first file name that starts with the
  564.             same characters as before the cursor.  The matching
  565.             file name is inserted in front of the cursor.
  566.             Alphabetic characters and characters in 'isfname'
  567.             are used to decide which characters are included in
  568.             the file name.  Note: the 'path' option is not used
  569.             here (yet).
  570.     CTRL-F    or
  571.     CTRL-N        Search forwards for next matching file name.  This
  572.             file name replaces the previous matching file name.
  573.  
  574.     CTRL-P        Search backward for previous matching file name.
  575.             This file name replaces the previous matching file
  576.             name.
  577.  
  578.  
  579. Completing definitions or macros            *compl-define*
  580.  
  581. The 'define' option is used to specify a line that contains a definition.
  582. The 'include' option is used to specify a line that contains an include file
  583. name.  The 'path' option is used to search for include files.
  584.  
  585.                             *i_CTRL-X_CTRL-D*
  586. CTRL-X CTRL-D        Search in the current and included files for the
  587.             first definition (or macro) name that starts with
  588.             the same characters as before the cursor.  The found
  589.             definition name is inserted in front of the cursor.
  590.     CTRL-D    or
  591.     CTRL-N        Search forwards for next matching macro name.  This
  592.             macro name replaces the previous matching macro
  593.             name.
  594.  
  595.     CTRL-P        Search backward for previous matching macro name.
  596.             This macro name replaces the previous matching macro
  597.             name.
  598.  
  599.     CTRL-X CTRL-D    Further use of CTRL-X CTRL-D will copy the words
  600.             following the previous expansion in other contexts
  601.             unless a double CTRL-X is used.
  602.  
  603.  
  604. Completing keywords from different sources        *compl-generic*
  605.  
  606.                             *i_CTRL-N*
  607. CTRL-N            Search backwards in the places given with the
  608.             'complete' option for words that start with the
  609.             keyword in front of the cursor.  The found keyword is
  610.             inserted in front of the cursor.
  611.  
  612.                             *i_CTRL-P*
  613. CTRL-P            Search forwards in the places given with the
  614.             'complete' option for words that start with the
  615.             keyword in front of the cursor.  The found keyword is
  616.             inserted in front of the cursor.
  617.  
  618.     CTRL-N        Search forward for next matching keyword.  This
  619.             keyword replaces the previous matching keyword.
  620.  
  621.     CTRL-P        Search backwards for next matching keyword.  This
  622.             keyword replaces the previous matching keyword.
  623.  
  624.     CTRL-X CTRL-N or
  625.     CTRL-X CTRL-P    Further use of CTRL-X CTRL-N or CTRL-X CTRL-P will
  626.             copy the words following the previous expansion in
  627.             other contexts unless a double CTRL-X is used.
  628.  
  629. ==============================================================================
  630. 7. Insert mode commands                    *inserting*
  631.  
  632. The following commands can be used to insert new text into the buffer.  They
  633. can all be undone and repeated with the "." command.
  634.  
  635.                             *a*
  636. a            Append text after the cursor [count] times.
  637.  
  638.                             *A*
  639. A            Append text at the end of the line [count] times.
  640.  
  641. <insert>    or                *i* *insert* *<Insert>*
  642. i            Insert text before the cursor [count] times.
  643.  
  644.                             *I*
  645. I            Insert text before the first non-blank in the line
  646.             [count] times.
  647.  
  648.                             *gI*
  649. gI            Insert text in column 1 [count] times.  {not in Vi}
  650.  
  651.                             *o*
  652. o            Begin a new line below the cursor and insert text,
  653.             repeat [count] times.  {Vi: blank [count] screen
  654.             lines}
  655.  
  656.                             *O*
  657. O            Begin a new line above the cursor and insert text,
  658.             repeat [count] times.  {Vi: blank [count] screen
  659.             lines}
  660.  
  661. These commands are used to start inserting text.  You can end insert mode with
  662. <Esc>.  See |mode-ins-repl| for the other special characters in Insert mode.
  663. the effect of [count] takes place after insert mode is exited.
  664.  
  665. When 'autoindent' is on, the indent for a new line is obtained from the
  666. previous line.  When 'smartindent' or 'cindent' is on, the indent for a line
  667. is automatically adjusted for C programs.
  668.  
  669. 'textwidth' can be set to the maximum width for a line.  When a line becomes
  670. too long when appending characters a line break is automatically inserted.
  671.  
  672.  
  673. ==============================================================================
  674. 8. Ex insert commands                    *inserting-ex*
  675.  
  676.                             *:a* *:append*
  677. :{range}a[ppend]    insert several lines of text below the specified
  678.             line.  if the {range} is missing, the text will be
  679.             inserted after the current line.
  680.  
  681.                             *:i* *:insert*
  682. :{range}i[nsert]    insert several lines of text above the specified
  683.             line.  if the {range} is missing, the text will be
  684.             inserted before the current line.
  685.  
  686. these two commands will keep on asking for lines, until you type a line
  687. containing only a ".".
  688.  
  689. ==============================================================================
  690. 9. Inserting a file                    *inserting-file*
  691.  
  692.                             *:r* *:read*
  693. :r[ead] [name]        Insert the file [name] (default: current file) below
  694.             the cursor.
  695.  
  696. :{range}r[ead] [name]    Insert the file [name] (default: current file) below
  697.             the specified line.
  698.  
  699.                             *:r!* *:read!*
  700. :r[ead] !{cmd}        Execute {cmd} and insert its standard output below
  701.             the cursor.  A temporary file is used to store the
  702.             output of the command which is then read into the
  703.             buffer.  'shellredir' is used to save the output of
  704.             the command, which can be set to include stderr or
  705.             not.  {cmd} is executed like with ":!{cmd}", any '!'
  706.             is replaced with the previous command |:!|.
  707.  
  708. These commands insert the contents of a file, or the output of a command,
  709. into the buffer.  They can be undone.  They cannot be repeated with the "."
  710. command.  They work on a line basis, insertion starts below the line in which
  711. the cursor is, or below the specified line.  To insert text above the first
  712. line use the command ":0r {name}".
  713.  
  714. After the ":read" command, the cursor is left on the first non-blank in the
  715. first new line.  Unless in Ex mode, then the cursor is left on the last new
  716. line (sorry, this is Vi compatible).
  717.  
  718. If a file name is given with ":r", it becomes the alternate file.  This can be
  719. used, for example, when you want to edit that file instead: ":e! #".  This can
  720. be switched off by removing the 'a' flag from the 'cpoptions' option.
  721.  
  722.                             *file-read*
  723. The 'fileformat' option sets the <EOL> style for a file:
  724. 'fileformat'    characters       name                ~
  725.   "dos"        <CR><NL> or <NL>   DOS format
  726.   "unix"    <NL>           Unix format
  727.   "mac"        <CR>           Mac format
  728. Previously 'textmode' was used.  It is obsolete now.
  729.  
  730. If 'fileformat' is "dos", a <CR> in front of an <NL> is ignored and a CTRL-Z
  731. at the end of the file is ignored.
  732.  
  733. If the 'fileformats' option is not empty Vim tries to recognize the type of
  734. <EOL> (see |file-formats|).  However, the 'fileformat' option will not be
  735. changed, the detected format is only used while reading the file.
  736.  
  737. On non-MS-DOS, Win32, and OS/2 systems the message "[dos format]" is shown if
  738. a file is read in DOS format, to remind you that something unusual is done.
  739. On Macintosh, MS-DOS, Win32, and OS/2 the message "[unix format]" is shown if
  740. a file is read in Unix format.
  741. On non-Macintosh systems, the message "[Mac format]" is shown if a file is
  742. read in Mac format.
  743.  
  744. An example on how to use ":r !":
  745. >  :r !uuencode binfile binfile
  746. This command reads "binfile", uuencodes it and reads it into the current
  747. buffer.  Useful when you are editing e-mail and want to include a binary
  748. file.
  749.  
  750.  vim:tw=78:ts=8:sw=8:
  751.